<?php



require 'database.php';

$__orderon__    =$_GET["orderno"];
// $__result__     =$_GET["result"];


$__result__=file_get_contents("texttojson.json");;
$__result__=json_decode($__result__,1);




file_put_contents("texttojson.json","");

$copyorder=file_get_contents("copyorder.json");
$copyorder=json_decode($copyorder,1);


for ($i = 0; $i < count($__result__); $i++) {
    if($__result__[$i][0]==$__orderon__){
        for ($a = 0; $a < count($copyorder); $a++) {
            if($__orderon__==$copyorder[$a]["order_no"]){
                if(stristr($__result__[$i][7],'-')){
                    $copyorder[$a]["result"]="no";
       
                }else{
                    $copyorder[$a]["result"]="yes";
                 
                }
            }
        }
    }
}

$copyorder=json_encode($copyorder,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE);
$f=file_put_contents("copyorder.json",$copyorder);
if($f){
    return json([
        "code"=>200,
        "msg"=>"success"
    ]);
}else{
    return json([
        "code"=>-1,
        "msg"=>"fuiled"
    ]);
}


